package com.A1908.util;

import com.A1908.dao.FeastInfoDao;
import com.A1908.dao.impl.FeastInfoDaoImpl;
import com.A1908.entity.FeastInfo;
import com.A1908.entity.User;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/*
* 测试连接池
* */
@WebServlet(urlPatterns = {"/test"})
public class TestServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request,response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        FeastInfoDao infoDao = new FeastInfoDaoImpl();
        User user=new User();
        user.setId(100000);
        List<FeastInfo> list = infoDao.getAllFeastInfo(user);
        if (list.size() > 0){
            response.getWriter().print(true);
        }else {
            response.getWriter().print(false);
        }

    }
}
